package com.wkhyapp.lm.contract;

import com.wkhyapp.lm.base.BasePresenter;
import com.wkhyapp.lm.http.ApiCallback;
import com.wkhyapp.lm.http.net.BaseRequest;
import com.wkhyapp.lm.http.net.GrabAlbumRequest;
import com.wkhyapp.lm.http.net.MemberListRequest;
import com.wkhyapp.lm.http.net.SuperResponse;
import com.wkhyapp.lm.http.vo.Banner;
import com.wkhyapp.lm.http.vo.Category;
import com.wkhyapp.lm.http.vo.Member;

/**
 * Created by Administrator on 2021-10-1.
 */

public class AdminPresenter extends BasePresenter<AdminView> {

    public AdminPresenter(AdminView adminView) {
        super(adminView);
    }


    public void addviews(Integer nums){
        BaseRequest request = new BaseRequest();
        request.setNums(nums);
        addSubscription(apiStores.addViews(request),new ApiCallback<SuperResponse<String>>() {
            @Override
            public void onSuccess(SuperResponse<String> response) {
                mvpView.setSucc();
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });
    }


    public void addHost(Integer nums){
        BaseRequest request = new BaseRequest();
        request.setNums(nums);
        addSubscription(apiStores.addhots(request),new ApiCallback<SuperResponse<String>>() {
            @Override
            public void onSuccess(SuperResponse<String> response) {
                mvpView.setSucc();
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });
    }


    public void zhuaqu(Integer userId,Integer pageNo,String url){
        GrabAlbumRequest request = new GrabAlbumRequest();
        request.setUserId(userId);
        request.setUrl(url);
        request.setPageNo(pageNo);
        addSubscription(apiStores.getAlbumAdd(request),new ApiCallback<SuperResponse<String>>() {
            @Override
            public void onSuccess(SuperResponse<String> response) {
                mvpView.getSucc(response.getItem());
            }
            @Override
            public void onFailure(String msg) {
                mvpView.getSucc(msg);
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });
    }
}
